function Bullet(type,playerNo,image)
{

	this.type = type;
	this.playerNo = playerNo;
	this.bitMap = new Bitmap(image);
	bulletsImg.addChild(this.bitMap);
	this.index = bulletsImg.getChildIndex(this.bitMap);
	this.atkType;

	this.bitMap.x = screenWidth/2 - this.bitMap.width/2;
	console.log("prout"+this.index);
	if(this.playerNo == 0)
	{
		this.bitMap.y = 0;

	}
	else
	{

		this.bitMap.y = screenHeight;
	}

	this.onUpdate = function()
	{

		if(this.playerNo == 0)
		{

			this.bitMap.y += 10;

		}
		else if (this.playerNo == 1)
		{

			this.bitMap.y -= 10;
		}

		//Collision bord terrain
		if(this.bitMap.y < 0 || this.bitMap.y > screenHeight)
		{
			console.log(bulletsImg.removeChildAt(this.bitmap,this.index));
			bullets.splice(this.index,1);

			doUpdate = true;
		}
	}
}

function instantiateBullet(type,playerNo)
{
	//bullets.addChild(refBullets[type+(playerNo*3)]);
	bullets.push(new Bullet(type,playerNo,refBullets[type+(playerNo*3)]));
	console.log("SHOOT"+type+playerNo*3);
	doUpdate = true;
}